<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>氦闪</title>
    <link rel="stylesheet" href="__PUBLIC__/web/css/city-picker.css">
    <link rel="stylesheet" href="__PUBLIC__/web/css/public.css">
    <link rel="stylesheet" href="__PUBLIC__/web/css/address_list.css">
</head>
<body>
<header>
    <include file="Index/header"/>
</header>


<div class="ly-master">
    <ul class="ly-nav">
        <li>
            <h1>服装索引</h1>
            <dd>系列</dd>
            <dl>
                <volist name="category" id="vo">

                    <dt><a href="{:U('Index/home', ['cate_id' => $vo['cate_id']])}">{$vo.cate_name}</a></dt>
                </volist>
            </dl>
        </li>
        <li>
            <dd ><a href="{:U('Index/user')}">我的订单</a></dd>
            <dd class="ly-cation"><a href="{:U('Address/address_list')}">收货信息</a></dd>
            <dd><a href="{:U('Index/user_info')}">账户信息</a></dd>
            <dd><a href="{:U('Index/sale')}">售后信息</a></dd>
        </li>
    </ul>
</div>

<section>
    <!--登录状态点击个人中心的界面-->
    <div class="ly-content ly-cent">
        <div class="ly-title">我的收货信息</div>
        <div class="ly-address">
            <ul class="ly-list">
                <volist name="lists" id="vo">
                    <li>
                        <h4>{$vo.fullname} <span style="margin-left: 100px">{$vo.phone}</span> <a href="javascript:;" class="ly-delete" addr_id="{$vo.id}">删除</a></h4>
                        <p>{$vo.province}{$vo.city}{$vo.country}{$vo.address}</p>
                    </li>
                </volist>
            </ul>
            <div class="ly-submit">
                <a href="javascript:;" class="ly-add">添加收货信息</a>
            </div>
        </div>
        <div class="ly-address ly-pas">
            <!--<h1>快递信息</h1>-->
            <!--<div class="ly-intro">-->
                <!--<img src="__PUBLIC__/web/images/icon_sf.png"/>-->
                <!--<p>所有商品默认使用顺丰快递进行派送</br> 若有疑问请联系氦闪 </p>-->
            <!--</div>-->
        </div>
    </div>

    <include file="Index/footer"/>
</section>

<div class="ly-layer">
    <div class="ly-cont">
        <form action="" id="address-form">
            <ul class="ly-list">
                <li>
                    <input type="text" name="city" id="city" class="ly-input" placeholder="请选择省市区"/>
                </li>
                <li>
                    <input type="text" name="address" class="ly-input" placeholder="详细地址"/>
                </li>
                <li>
                    <input type="text" name="fullname" class="ly-input" placeholder="收货人姓名"/>
                </li>
                <li>
                    <input type="text" name="phone" class="ly-input" placeholder="手机号码" maxlength="11"/>
                </li>
                <li>
                    <a class="ly-submit-up">保存</a>
                </li>
            </ul>
        </form>
        <div class="ly-close"><img src="__PUBLIC__/web/images/icon_close.png"/></div>
    </div>
</div>
<div class="ly-menu-nav" data-id="1">
    <img src="__PUBLIC__/web/images/icon_menu.png" />
</div>
</body>
<script src="__PUBLIC__/web/js/jquery.min.js"></script>
<script src="__PUBLIC__/web/js/reg.js"></script>
<script src="__PUBLIC__/web/js/city-picker.data.js"></script>
<script src="__PUBLIC__/web/js/city-picker.js"></script>
<script src="__PUBLIC__/web/js/public.js"></script>
<script>
    $(".ly-add").on("click",function () {
        $(".ly-layer").show();
    })
    $(".ly-close").on("click",function () {
        $(".ly-layer").hide();
    })
    $("#city").click(function (e) {
        SelCity(this, e);
        console.log("inout", $(this).val(), new Date())
    });

    $('.ly-submit-up').click(function () {
        var formData = $('#address-form').serializeArray();
        $.ajax({
            url: "{:U('Cart/addAddr')}",
            dataType:"json",
            data:{formData:formData},
            type:'POST',
            async:true,
            beforeSend:function(){

//                $("body").showLoading();
            },
            success:function(rst){
                console.log(rst);
                if(rst.code == '200') {
                    window.location.reload();
                } else {
                    alert(rst.mark);
                }
            },
            error: function(){
//                $("body").hideLoading();
//                    alert("错误");
            }

        });
    })

    $('.ly-delete').on("click",function () {
        var addr_id = $(this).attr('addr_id');
        if(confirm('确认删除吗？')) {
            $.ajax({
                url: "{:U('delAddr')}",
                dataType:"json",
                data:{addr_id:addr_id},
                type:'POST',
                async:true,
                beforeSend:function(){

//                $("body").showLoading();
                },
                success:function(rst){
                    console.log(rst);
                    if(rst.code == '200') {
                        window.location.reload();
                    } else {
                        alert(rst.mark);
                    }
                },
                error: function(){
//                $("body").hideLoading();
//                    alert("错误");
                }

            });
        }

    })
</script>
</html>





